<template>
	<div class="full-height container-fluid">
		<div class="full-height row">
			 <!--侧栏 -->
			<div class="full-height col-xs-2 col-sm-2">
				<MSidebar :plock="permision_lock" :net="netStatus" :WebRTC="rtc" :host='host'></MSidebar>
			</div>
			<!-- 显示区 -->
			<div class="full-height col-xs-10 col-sm-10">
				<router-view :WebRTC="rtc" :plock="permision_lock"></router-view>
			</div>
		</div>
	</div>
</template>

<script>
import './js/properties';
import {WebRTC} from './js/WebRTC-handler.js';
import MSidebar from './components/MSidebar.vue';
import { Message } from 'element-ui';
export default {
  name: 'app',
  components:{MSidebar},
  data(){
	  return {
		rtc:WebRTC,
		permision_lock:false,
		host:{
			name:'游客'
		}
	  }
  },
  beforeMount(){
	  console.log("App.vue被处罚");
		let self = this;
		//查询当前在线状态
		$.ajax({
			type:'POST',
			// async:true,
			url:domain+'/user/status',
			dataType:'json',
			xhrFields:{
				withCredentials:true
			},
			crossDomain:true,
			success:function(data){
				console.log(data);
				if("online" == data.code){
					self.permision_lock = true;
					self.host = data.data;
				}
			},
			error:function(e){
				console.log("没有登录，无法获取");
			}
		});
	  //初始化WebRTC
	WebRTC.init();
  },
	mounted(){
		// this.$message("欢迎登录系统");
		// Message.success("欢迎登录系统");
	},
  computed:{
	  netStatus(){
		  if(this.rtc.connflag){
			  return '正常';
		  }else{
		  	return '与服务器断开链接';
		  }
	  }
  }
}
</script>

<style scoped>
.full-height{
	height:100%;
}
</style>